import moment from 'moment'

// 流程中心-列表
export const listThead = [
  {
    type: 'selection',
    minWidth: 60,
    align: 'center'
  },
  {
    title: '流程编号',
    key: 'workFlowNo',
    minWidth: 180
  },
  {
    title: '流程名称',
    key: 'workFlowName',
    minWidth: 180
  },
  {
    title: '流程主题',
    key: 'workFlowTheme',
    minWidth: 180
  },
  {
    title: '费用月份',
    key: 'ym',
    minWidth: 120,
    render: (h, params) => {
      const workFlowContent = params.row.workFlowContent ? JSON.parse(params.row.workFlowContent) : {}
      const month = !workFlowContent.Month ? '' : workFlowContent.Month < 10 ? '0' + workFlowContent.Month : workFlowContent.Month
      const ym = workFlowContent.Year && month ? workFlowContent.Year + '-' + month : ''
      return h('span', ym)
    }
  },
  {
    title: '请款金额',
    key: 'requestAmt',
    minWidth: 120,
    render: (h, params) => {
      const workFlowContent = params.row.workFlowContent ? JSON.parse(params.row.workFlowContent) : {}
      return h('span', workFlowContent.RequestAmt)
    }
  },
  {
    title: '垫付金额',
    key: 'paidAmt',
    minWidth: 120,
    render: (h, params) => {
      const workFlowContent = params.row.workFlowContent ? JSON.parse(params.row.workFlowContent) : {}
      return h('span', workFlowContent.PaidAmt)
    }
  },
  {
    title: '说明',
    key: 'remark',
    minWidth: 120,
    render: (h, params) => {
      const workFlowContent = params.row.workFlowContent ? JSON.parse(params.row.workFlowContent) : {}
      return h('span', workFlowContent.Remark)
    }
  },
  {
    title: '当前所处步骤',
    key: 'stepName',
    minWidth: 120,
  },
  {
    title: '当前步骤审批人',
    key: 'curApprovalUser',
    minWidth: 180,
  },
  {
    title: '申请人',
    key: 'creater',
    minWidth: 120,
  },
  {
    title: '申请时间',
    key: 'createTime',
    minWidth: 180,
    render: (h, params) => {
      const text = params.row.createTime ? moment(params.row.createTime).format('YYYY-MM-DD HH:mm') : ''
      return h('span', text)
    }
  },
  {
    title: '完成时间',
    key: 'doneTime',
    minWidth: 180,
    render: (h, params) => {
      const text = params.row.doneTime ? moment(params.row.doneTime).format('YYYY-MM-DD HH:mm') : ''
      return h('span', text)
    }
  },
  {
    title: '流程状态',
    key: 'workFlowStatus',
    minWidth: 120,
  },
  {
    title: '操作',
    key: 'action',
    minWidth: 360,
    slot: 'action',
    fixed: 'right',
    align: 'center',
  }
]

// 流程中心-进度查看
export const scheduleThead = [
  {
    title: '步骤名称',
    key: 'stepName',
    minWidth: 150,
  },
  {
    title: '发起人',
    key: 'createrName',
    minWidth: 150,
  },
  {
    title: '发送时间',
    key: 'createTime',
    minWidth: 180,
    render: (h, params) => {
      const text = params.row.createTime ? moment(params.row.createTime).format('YYYY-MM-DD HH:mm') : ''
      return h('span', text)
    }
  },
  {
    title: '审批人',
    key: 'operatorName',
    minWidth: 150,
  },
  {
    title: '审批时间',
    key: 'operatTime',
    minWidth: 180,
    render: (h, params) => {
      const text = params.row.operatTime ? moment(params.row.operatTime).format('YYYY-MM-DD HH:mm') : ''
      return h('span', text)
    }
  },
  {
    title: '状态',
    key: 'status',
    minWidth: 150,
  },
  {
    title: '备注',
    key: 'remark',
    minWidth: 150,
  },
]
